package com.dhh.nutrition.manager;

import java.util.List;

import android.util.Pair;

import com.dhh.nutrition.dao.DataBaseHelper;
import com.dhh.nutrition.dao.FoodDAO;
import com.dhh.nutrition.model.NutritionFacts;
import com.dhh.nutrition.vo.Food;

public class FoodManager {
	private FoodDAO dao;
	
	public FoodManager(DataBaseHelper db){
		dao = new FoodDAO(db);
	}
	
	public Food getFood(String fno){
		return dao.getFood(fno);
	}
	
	public NutritionFacts getNutritionFact(String foodNo){
		Food food = dao.getFood(foodNo);
		NutritionFacts facts = new NutritionFacts(food);
		
		return facts;
	}	
	
	public Pair<Boolean, List<Food>> getFoods(String foodGroup,String foodName,int page){
		List<Food> foods = dao.listFoods(foodGroup, foodName,page);
		return new Pair<Boolean, List<Food>>(foods.size()>0,foods); 
	}
	
	
}
